package cc.cix.gt.org.dto.request;

import cc.cix.gt.common.annotation.IsMobile;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.validation.groups.Default;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author cix
 */
@Data
@ApiModel(value = "UserDTO对象", description = "用户")
public class UserReq {

    public interface AddUser extends Default {}

    @ApiModelProperty("用户 ID")
    private Long id;

    @Size(min = 2, max = 20, message = "长度非法")
    @ApiModelProperty("用户名")
    private String username;

    @NotBlank(message = "密码不能为空", groups = AddUser.class)
    @ApiModelProperty("密码")
    private String password;

    @ApiModelProperty("部门 ID")
    private Long deptId;

    @Size(max = 50, message = "长度非法")
    @Email(message = "邮箱格式非法")
    @ApiModelProperty("邮箱")
    private String email;

    @IsMobile(message = "手机号格式非法")
    @ApiModelProperty("联系电话")
    private String mobile;

    @NotBlank(message = "状态不能为空")
    @ApiModelProperty("状态：0=锁定，1=有效")
    private String status;

    @ApiModelProperty("最近访问时间")
    private LocalDateTime lastLoginTime;

    @NotBlank(message = "性别不能为空")
    @ApiModelProperty("性别：0=男，1=女，2=保密")
    private String sex;

    @ApiModelProperty("头像")
    private String avatar;

    @Size(max = 100, message = "描述长度非法")
    @ApiModelProperty("描述")
    private String description;

    @NotNull(message = "角色 ID 不能为空")
    @ApiModelProperty("角色 ID 列表")
    private List<Long> roleIds;

    @NotNull(message = "部门 ID 不能为空")
    @ApiModelProperty("部门 ID 列表")
    private List<Long> deptIds;

}
